#include "gldrcube.h"
GlDrCube::GlDrCube()
{
    dirx=1;
    dirz=-1;
    diry=1;
}


void GlDrCube::objAnim()
{
    if(transx>200) dirx=-1;
    if(transy>200) diry=-1;
    if(transz>200) dirz=-1;
    if(transx<-200) dirx=1;
    if(transy<-200) diry=1;
    if(transz<-200) dirz=1;
    move(dirx,diry,dirz);
    rotate(0.1,0.1,0.1);
}

void GlDrCube::objDraw()
{
    glColor3f(1.0,0.0,1.0);
    int size = 30;
    glBegin(GL_QUADS);					// Start Drawing The Cube
                glColor3f(0.0f,1.0f,0.0f);			// Set The Color To Green
                glVertex3f( size, size,-size);			// Top Right Of The Quad (Top)
                glVertex3f(-size, size,-size);			// Top Left Of The Quad (Top)
                glVertex3f(-size, size, size);			// Bottom Left Of The Quad (Top)
                glVertex3f( size, size, size);			// Bottom Right Of The Quad (Top)
                glColor3f(1.0f,0.5f,0.0f);			// Set The Color To Orange
                glVertex3f( size,-size, size);			// Top Right Of The Quad (Bottom)
                glVertex3f(-size,-size, size);			// Top Left Of The Quad (Bottom)
                glVertex3f(-size,-size,-size);			// Bottom Left Of The Quad (Bottom)
                glVertex3f( size,-size,-size);			// Bottom Right Of The Quad (Bottom)
                glColor3f(1.0f,0.0f,0.0f);			// Set The Color To Red
                glVertex3f( size, size, size);			// Top Right Of The Quad (Front)
                glVertex3f(-size, size, size);			// Top Left Of The Quad (Front)
                glVertex3f(-size,-size, size);			// Bottom Left Of The Quad (Front)
                glVertex3f( size,-size, size);			// Bottom Right Of The Quad (Front)
                glColor3f(1.0f,1.0f,0.0f);			// Set The Color To Yellow
                glVertex3f( size,-size,-size);			// Bottom Left Of The Quad (Back)
                glVertex3f(-size,-size,-size);			// Bottom Right Of The Quad (Back)
                glVertex3f(-size, size,-size);			// Top Right Of The Quad (Back)
                glVertex3f( size, size,-size);			// Top Left Of The Quad (Back)
                glColor3f(0.0f,0.0f,1.0f);			// Set The Color To Blue
                glVertex3f(-size, size, size);			// Top Right Of The Quad (Left)
                glVertex3f(-size, size,-size);			// Top Left Of The Quad (Left)
                glVertex3f(-size,-size,-size);			// Bottom Left Of The Quad (Left)
                glVertex3f(-size,-size, size);			// Bottom Right Of The Quad (Left)
                glColor3f(1.0f,0.0f,1.0f);			// Set The Color To Violet
                glVertex3f( size, size,-size);			// Top Right Of The Quad (Right)
                glVertex3f( size, size, size);			// Top Left Of The Quad (Right)
                glVertex3f( size,-size, size);			// Bottom Left Of The Quad (Right)
                glVertex3f( size,-size,-size);			// Bottom Right Of The Quad (Right)
        glEnd();
}
